home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / bit / src / forms / FORMS / NEW.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  89 lines

  1. /*
  2.  This is an example file showing which routines should be provided
  3.  to add a class of objects to the forms library.
  4.  Also some changes have to be made to the file forms.h.
  5. */
  6.  
  7. /*
  8.  * NEW.c
  9.  *
  10.  * Forms Object class:
  11.  *
  12.  * Written by:
  13.  *
  14.  * Version
  15.  * Date:
  16.  */
  17.  
  18. #include "forms.h"
  19.  
  20. static int fl_handle_NEW(FL_OBJECT *ob, int event, float mx, float my, char key)
  21. /* Handles an event, returns whether value has changed. */
  22. {
  23.   switch (event)
  24.   {
  25.     case FL_DRAW:
  26.      /* Draw the object */
  27.         return 0;
  28.     case FL_ENTER:
  29.     /* Handle a mouse enter event (mx,my is the mouse position) */
  30.         return ???;
  31.     case FL_LEAVE:
  32.     /* Handle a mouse leave event (mx,my is the mouse position) */
  33.         return ???;
  34.     case FL_MOVE:
  35.     /* Mouse was moved in object. mx, my is the new mouse position */
  36.         return ???;
  37.     case FL_PUSH:
  38.     /* Handle a mouse push event (mx,my is the mouse position) */
  39.         return ???;
  40.     case FL_RELEASE:
  41.     /* Handle a mouse release event (mx,my is the mouse position) */
  42.         return ???;
  43.     case FL_MOUSE:
  44.     /* Mouse was moved while pushed. mx, my is the new mouse position */
  45.         return ???;
  46.     case FL_FOCUS:
  47.     /* Handle an input focus event */
  48.         return ???;
  49.     case FL_UNFOCUS:
  50.     /* Handle an input unfocus event */
  51.         return ???;
  52.     case FL_KEYBOARD:
  53.     /* Handle a keyboard event. key is the key pressed. */
  54.         return ???;
  55.     case FL_STEP:
  56.     /* Handle a step event (when automatic) */
  57.         return ???;
  58.     case FL_SHORTCUT:
  59.     /* Handle the use of a keyboard shortcut */
  60.     return ???;
  61.     case FL_FREEMEM:
  62.     /* Free any memory allocated by the object. */
  63.     return 0;
  64.   }
  65.   return 0;
  66. }
  67.  
  68. /*------------------------------*/
  69.  
  70. FL_OBJECT *fl_create_NEW(int type, float x, float y, float w, float h, char label[])
  71. /* Create an object */
  72. {
  73.   FL_OBJECT *ob;
  74.   ob = fl_make_object(FL_NEW,type,x,y,w,h,label,handle_NEW);
  75.  
  76.   /* FILLING IN DEFAULTS */
  77.  
  78.   return ob;
  79. }
  80.  
  81. FL_OBJECT *fl_add_NEW(int type, float x, float y, float w, float h, char label[])
  82. /* Adds an object */
  83. {
  84.   FL_OBJECT *ob;
  85.   ob = fl_create_NEW(type,x,y,w,h,label);
  86.   fl_add_object(fl_current_form,ob);
  87.   return ob;
  88. }
  89.